"""

"""
'''
    当执行时，出现异常，可以把当前页面的图片截取下来，方便定位问题
'''
import time
from time import sleep

from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Edge()
driver.get("http://www.baidu.com")
driver.find_element(By.ID, "kw").send_keys("javascript是什么")
driver.find_element(By.ID, "su").click()

a = time.strftime("%Y-%m-%d_%H%M%S", time.localtime()) # 时间戳

# driver.get_screenshot_as_file(f"img{a}.png")

driver.get_screenshot_as_file(f"D:\\APP DATA\\pythonfile\\UIAutoTest\\Selenium基础\\screenshot\\img-{a}.png")
driver.quit()